package com.wct.springcloud.service;

import com.wct.springcloud.mapper.DeptMapper;
import com.wct.springcloud.model.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author WEI (Email:changtan20000@163.com)
 * @description
 * @date: 2019/12/11 16:43
 */
@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    private DeptMapper deptMapper;
    @Override
    public boolean add(Dept dept) {
        int id = deptMapper.insert(dept);
        if (id != -1) {
            return false;
        }
        return true;
    }

    @Override
    public Dept get(Integer id) {
        return deptMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Dept> list() {
        return deptMapper.selectAll();
    }

    @Override
    public int update(Dept record) {
        return deptMapper.updateByPrimaryKey(record);
    }

    @Override
    public int delete(Integer deptno) {
        return deptMapper.deleteByPrimaryKey(deptno);
    }
}
